﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace CommonApp.Models
{
    public class Client
    {
        [HiddenInput]
        public virtual int? Id { get; set; }

        [Required]
        [Display(Name = "First Name")]
        [StringLength(50, ErrorMessage = "The {0} must be maximum {1} characters long.")]
        [RegularExpression(@"^[A-Z][a-zA-Z]+$", ErrorMessage = "{0} should contain letters, starting with capital one")]
        public virtual string FirstName
        {
            get;
            set;
        }

        [Required]
        [Display(Name = "Last Name")]
        [StringLength(50, ErrorMessage = "The {0} must be maximum {1} characters long.")]
        [RegularExpression(@"^[A-Z][a-zA-Z]+$", ErrorMessage = "{0} should contain letters, starting with capital one")]
        public virtual string LastName
        {
            get;
            set;
        }
        
        [Required]
        [Display(Name = "Passport Number")]
        [RegularExpression("^[0-9]{7}$", ErrorMessage = "Invalid Passport Number")]
        public virtual int PassportNumber
        {
            get;
            set;
        }

        [Required]
        [Display(Name = "Passport Series")]
        [StringLength(2, MinimumLength = 2, ErrorMessage = "The {0} must be 2 characters long.")]
        [RegularExpression("^[A-Z]{2}$", ErrorMessage = "Passport series must be 2 capital letters.")]
        public virtual string PassportSeries
        {
            get;
            set;
        }
        
        [Required]
        [Display(Name = "Date of Birth")]
        [DataType(DataType.Date)]
        [DateRangeValidation(MinYears = -100, MaxYears = -16, ErrorMessage = "The {0} should be 100-16 years ago")]
        public virtual DateTime? DateOfBirth
        {
            get;
            set;
        }
    }
}